//-----------------------------------------------------------------------
// <copyright file="tblOpicsTransactionDAO.cs" company="Scb">
//     Copyright ? Scb. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
	
using System;
using System.Data;
using System.Data.Common;
using Robot.Entities;
using Scb.Framework;
using Scb.Framework.Data;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace Robot.Data
{	
	public class tblOpicsTransactionDAO : tblOpicsTransactionDAOBase
	{
		public tblOpicsTransactionDAO()
		{
		}

    public virtual tblOpicsTransactionCollection GettblOpicsTransactionListByStatus(int status)
    {
      try
      {
        Database database = DatabaseFactory.CreateDatabase();
        DbCommand dbCommand = database.GetStoredProcCommand("_sptblOpicsTransactionGetByStatus");

        database.AddInParameter(dbCommand, "@Status", DbType.Int32, status);
       

        tblOpicsTransactionCollection tblOpicsTransactionCollection = new tblOpicsTransactionCollection();
        using (IDataReader reader = DataAccessHelper.ExecuteReader(database, dbCommand))
        {
          while (reader.Read())
          {
            tblOpicsTransaction tblOpicsTransaction = CreatetblOpicsTransactionFromReader(reader);
            tblOpicsTransactionCollection.Add(tblOpicsTransaction);
          }
          reader.Close();
        }
       
        return tblOpicsTransactionCollection;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new DataAccessException(SR.DataAccessGettblOpicsTransactionListException, ex);
      }
    }

	}
}
